Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
These patches support use of a google clientID and digital signature generated from the private cryptographic key. The details of using the signature are hidden away at the bottom of:
https://developers.google.com/maps/documentation/geocoding/get-api-key#premium-auth
Python code is down the bottom too.
It turns out it isn't a matter of combining the key and client id in the url, which was what the existing code appears to do, but rather using the key to create a signature for the rest of the url and appending that. Originally I was using our organisational plan via modified versions of ggmap functions and calling python from R. However, the updated version of ggmap makes the integration much easier, and worth figuring out how to avoid the python part.
Apologies if there is yet another version of google authentication that the patches I've suggested breaks. I don't think this is the case. I've tested all the examples after setting the client id and signature using
and everything seems OK when using my organisational details. If it isn't too widely used, it may be appropriate to change the "signature" term to "secretkey". I haven't done that.
My implementation of the signing function adds a dependency on urltools, which you may not like. Let me know If you'd prefer some other url parser instead. The other dependency is base64enc.
Potential weaknesses - the python signer mentions url safe base 64 encoding. Some searching suggests that this is a matter of swapping characters around. I'm not completely convinced I've done this in the appropriate place. I've done it using character translation after encoding/decoding. However it may be better to change the encoding/decoding alphabet. I'm not sure yet whether this is possible with existing R base64 encoding functions.